package com.lutzyt.delivery.exception;

import com.lutzyt.delivery.util.Result;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

/**
 * @Author: zyt
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class BusinessException extends RuntimeException {
  private int code;
  private String message;

  public Result<Void> toResult(){
    Result<Void> result = new Result<>();
    result.setMessage(message);
    result.setCode(code);
    return  result;
  }
}
